package cn.net.yugu.doraemon.event.spring;

import java.util.Arrays;
import java.util.Objects;
import java.util.Optional;

import lombok.Getter;

/**
 * @author xiangzhurui
 * @version 2022/12/24 10:21:58
 */
@Getter
public enum EventBusType {

    Guava("guava", "Guava EventBus");

    private final String code;
    private final String desc;

    EventBusType(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static Optional<EventBusType> parseCode(String code) {
        return Arrays.stream(values())
                .filter(eventBusType -> Objects.equals(code, eventBusType.code))
                .findFirst();
    }
}
